package tool

import "encoding/json"

func CreateMapString() map[string]interface{} {
	return map[string]interface{}{}
}
func CreateMapInt() map[int]interface{} {
	return map[int]interface{}{}
}

type IntKeyMap map[int]interface{}

func (s IntKeyMap) Len() int           { return len(s) }
func (s IntKeyMap) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s IntKeyMap) Less(i, j int) bool { return i < j }

type StringKeyMap map[string]interface{}

func (s StringKeyMap) Len() int              { return len(s) }
func (s StringKeyMap) Swap(i, j string)      { s[i], s[j] = s[j], s[i] }
func (s StringKeyMap) Less(i, j string) bool { return i < j }

type M map[string]interface{}

func (s M) Len() int              { return len(s) }
func (s M) Swap(i, j string)      { s[i], s[j] = s[j], s[i] }
func (s M) Less(i, j string) bool { return i < j }
func (s *M) String() string {data,_:=json.Marshal(s);return string(data)}